﻿using System;
using System.ComponentModel;

namespace MediaBrowser.Entities
{
    /// <summary>
    /// Classe Métier de Base
    /// </summary>
    public class BaseItem : INotifyPropertyChanged
    {
        public int Id { get; set; }

        private String name;
        public String Name
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
                OnPropertyChanged("Name");
            }
        }

        private String description;
        public String Description
        {
            get
            {
                return description;
            }
            set
            {
                if (value != null)
                {
                    description = value;
                }
                else
                {
                    description = "";
                }
                OnPropertyChanged("Description");
            }
        }

        public DateTime DateCreation { get; set; }

        public BaseItem(int id, String name, DateTime dateCreation, String description)
        {
            this.Id = id;
            this.Name = name;
            this.DateCreation = dateCreation;
            this.Description = description;
        }
        
        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;
        protected void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
        #endregion
                
    }
}
